rubymafiamodsfandomcom-20200215-history
The basics of scripting
This is where you can learn some of the most basic scripts. As well as the basics of scripting. Step 1: Crucial Knowledge. First off, Bscript view 0.4 is the best tool I find to use for scripting but you can also use DCED for scripting too if you want. So, The first things which need to be remembered are the following... dim_act x (replace "x" with a number) = this command represents the number of "actors" you wish to have in the script (an actor is usually a person but it can also be a car, or a door or even another script itself) dim_flt x (replace "x" with a number) = this command represents the number of values in the script. I have never really had much use for this as next to all the things I do can be done without values so I cannot explain it well. But it is always best to write this command in anyway dim_frm x (replace "x" with a number) = this command represents the number of "frames" you wish to have in the script (a frame is an object that can be used for a purpose. An example of this would be to have a chair as a frame and add a fire particle to it to give it an apperance that it is on fire. Frames can be anything from chairs to cigarettes to even a human actor's left hand) and lastly... findactor x,"Enter name of actor here" (replace "x" with a number, "findactor" can also be replaced with "findframe" depending on what you want) = this command defines an actor (or frame) you wish to put in the script. So for example if I was to put in... findactor 0,"Tommy" = then I would have the player character in my script to use. These 4 lines of code must always be placed at the begining of a script like so... dim_act x dim_flt x dim_frm x findactor x,"Enter name of actor" With me so far? Good :) NOTE!: Should anyone have any questions you can always send me a message (see home page) and I'll get back to you soon as I can. Step 2: Your first script. Making an average civilian script. One of the first scripts I ever did was to just fill up an area of Lost Heaven﻿ with scripted people doing various everyday things. Just to make the city come more to life. To do this we do the following. As in the "How to mod Mafia" section (Step 3: your first mod) we start by starting Bscript view and loading our mission (for this tutorial the mission will again be FREERIDE). Once you've loaded the FREERIDE scene2.bin click on Insert/human and do this (similer to what you did on the How to mod Mafia page) *For this tutorial we shall name him "Civilian 1" but you can call him whatever you want. *Where it says "Model" just type in "civil11.i3d" (You can use whatever number you want, so civil33.i3d for example) *Where it says "Size" just type the number 1 in each of the three boxes *Where it says "Behaviour" choose "Afraid" *Where it says "Aggression" change it from 0.5 to 0 Everything else can be left how it is. Now go into Mafia Editor again (as in the How to mod Mafia section) and position your new Civilian anywhere in the city you want him to be. Once this is done save the mission (best to "double tap" the save button to make sure it does it) Once this is done, exit Mafia Editor and re-open BScript View and re-load "FREERIDE". Then click on Civilian 1 again, in a white box to the right of him should be something looking like this "\\\\\\\\\\\\\\\\\\". Replace those dashes with this script. dim_act 5 dim_flt 5 dim_frm 5 findactor 0,"Tommy" findactor 1,"Civilian 1" label 1 enemy_playanim "Nudastativ.i3d" wait 7000 goto 1 This script will just make the civilian stand around on the spot and look at the ground (as if he waiting for something or someone). But you can replace the "Nudastativ" with another animation. (A full list of animations from A-Z can be found Here) Now I'll explain the other commands I put in this script. Label x (replace the "x" with whatever number (or letter) you want) = This can be used to "save" a certain part of a script so you can go back to it later using the "goto x" command. enemy_playanim "enter animation name.i3d" = Used to make a human actor play an animation in game to stop him just standing about as stiff as a board. (There are so man different animations, from smoking, to waiting, to talking, to dieing. You really can make it all happen). wait x (replace the "x" with a number) = This command makes the script "wait" for a certain number of mili-seconds. For those that do not know a thousend mili-seconds is one second. So say you wanted to make the script wait for ten seconds you would put the following "wait 10000" and the script would then wait for ten seconds before continuing. goto x (replace the "x" with whatever number (or letter) you put for the "label" command) = this command can be used to send the script back to the corrisponding label to keep it playing on a continuous loop. So there we are ladies and gents. Your first (hopefully not your last) civilian. Now lets move onto something else. Creating a custom save point (Either by key or by a "quicksave" every so often) This scipt will teach you how you can put in a save feature in FREERIDE (I bet your all tired of having to drive to Salieri's everytime you wish to save). Doing this is very easy. First we will cover the autosave feature. (you can choose to put in either the autosave one, or the key activated one. But do not put them both in or it'll confuse the game). *Open up Bscript view *FILE/OPEN *Load up FREERIDE's scene2.bin *select insert/other *Call it something like "Autosave" or something. Then set the "Trans" boxes to 0,0,0 (one 0 in each box) and the "Size" boxes to 1,1,1 (a 1 in each box) and click insert. *With this done just paste the following script dim_act 5 dim_flt 5 dim_frm 5 findactor 0,"Tommy" label 1 autosavegamefull 5584 wait 60000 wait 60000 wait 60000 wait 60000 wait 60000 wait 60000 wait 60000 wait 60000 wait 60000 wait 60000 goto 1 Then just click the save button and then thats it, While playing in FREERIDE the game will save every ten minutes. NEW COMMAND LEARNED!: "autosavegamefull x" (replace the "x" with the text number (which can be found using Mafia Text editor) = This is the command used to save in the selected slot. For example, this script uses the number 5584 because that is FREERIDE's save point. Now we will cover the key activated save. start off by doing the same as you did last time (load up Bscript view and do the same instructions) Now instead, copy and paste this script label 1 ctrl_read 0, OBJECTIVES if flt0 = 0, -1, 1 autosavegamefull 5584 goto 1 There we are then, the basics of scripting covered. Of course I can't teach you everything, why not take a look at the full list of scripting commands page and try and write your own script to bend the game to however you want. Don't worry, if it seems hard now you'll pick it up with ease sooner or later (its taken me months to get to where I am and regardless of how experianced I am, I still learn new things all the time :).